From 994f8216f1ff1fa75c05b11a6070cc132b35c39b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Nov 2004 19:15:44 +0000 Subject: [PATCH] Make return types G_CONST_RETURN instead of const. 2004-11-09 Matthias Clasen * gtk/gtkaction.[hc]: * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN instead of const. * gtk/gtk.symbols: * gtk/gtkaction.h: * gtk/gtkaction.c (gtk_action_get_accel_path): Add a function to obtain the accel path of an action. (#148106, Michael Natterer) --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ gtk/gtk.symbols | 1 + gtk/gtkaction.c | 26 +++++++++++++++++++++++++- gtk/gtkaction.h | 3 ++- gtk/gtkactiongroup.c | 2 +- gtk/gtkactiongroup.h | 2 +- 9 files changed, 70 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 557cb0c10b..bca495a51a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2004-11-09 Matthias Clasen + * gtk/gtkaction.[hc]: + * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN + instead of const. + + * gtk/gtk.symbols: + * gtk/gtkaction.h: + * gtk/gtkaction.c (gtk_action_get_accel_path): Add + a function to obtain the accel path of an action. (#148106, + Michael Natterer) + * tests/testiconview.c: Fix double-click activation. * gtk/gtkstatusbar.c (gtk_statusbar_init): Raise the grip diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 557cb0c10b..bca495a51a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,15 @@ 2004-11-09 Matthias Clasen + * gtk/gtkaction.[hc]: + * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN + instead of const. + + * gtk/gtk.symbols: + * gtk/gtkaction.h: + * gtk/gtkaction.c (gtk_action_get_accel_path): Add + a function to obtain the accel path of an action. (#148106, + Michael Natterer) + * tests/testiconview.c: Fix double-click activation. * gtk/gtkstatusbar.c (gtk_statusbar_init): Raise the grip diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 557cb0c10b..bca495a51a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,15 @@ 2004-11-09 Matthias Clasen + * gtk/gtkaction.[hc]: + * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN + instead of const. + + * gtk/gtk.symbols: + * gtk/gtkaction.h: + * gtk/gtkaction.c (gtk_action_get_accel_path): Add + a function to obtain the accel path of an action. (#148106, + Michael Natterer) + * tests/testiconview.c: Fix double-click activation. * gtk/gtkstatusbar.c (gtk_statusbar_init): Raise the grip diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 557cb0c10b..bca495a51a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,15 @@ 2004-11-09 Matthias Clasen + * gtk/gtkaction.[hc]: + * gtk/gtkactiongroup.[hc]: Make return types G_CONST_RETURN + instead of const. + + * gtk/gtk.symbols: + * gtk/gtkaction.h: + * gtk/gtkaction.c (gtk_action_get_accel_path): Add + a function to obtain the accel path of an action. (#148106, + Michael Natterer) + * tests/testiconview.c: Fix double-click activation. * gtk/gtkstatusbar.c (gtk_statusbar_init): Raise the grip diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 39ac93de72..4205c828ae 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -91,6 +91,7 @@ gtk_action_create_menu_item gtk_action_create_tool_item gtk_action_disconnect_accelerator gtk_action_disconnect_proxy +gtk_action_get_accel_path gtk_action_get_name gtk_action_get_proxies gtk_action_get_sensitive diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index abd1a718eb..d77f5488ca 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -1193,7 +1193,7 @@ gtk_action_get_proxies (GtkAction *action) * * Since: 2.4 **/ -const gchar * +G_CONST_RETURN gchar * gtk_action_get_name (GtkAction *action) { g_return_val_if_fail (GTK_IS_ACTION (action), NULL); @@ -1438,6 +1438,30 @@ gtk_action_set_accel_path (GtkAction *action, action->private_data->accel_quark = g_quark_from_string (accel_path); } +/** + * gtk_action_get_accel_path: + * @action: the action object + * + * Returns the accel path for this action. + * + * Since: 2.6 + * + * Returns: the accel path for this action, or %NULL + * if none is set. The returned string is owned by GTK+ + * and must not be freed or modified. + */ +G_CONST_RETURN gchar * +gtk_action_get_accel_path (GtkAction *action) +{ + g_return_val_if_fail (GTK_IS_ACTION (action), NULL); + + if (action->private_data->accel_quark) + return g_quark_to_string (action->private_data->accel_quark); + else + return NULL; +} + + /** * gtk_action_set_accel_group: * @action: the action object diff --git a/gtk/gtkaction.h b/gtk/gtkaction.h index 6449748608..193e9dcd83 100644 --- a/gtk/gtkaction.h +++ b/gtk/gtkaction.h @@ -85,7 +85,7 @@ GtkAction *gtk_action_new (const gchar *name, const gchar *label, const gchar *tooltip, const gchar *stock_id); -const gchar* gtk_action_get_name (GtkAction *action); +G_CONST_RETURN gchar* gtk_action_get_name (GtkAction *action); gboolean gtk_action_is_sensitive (GtkAction *action); gboolean gtk_action_get_sensitive (GtkAction *action); void gtk_action_set_sensitive (GtkAction *action, @@ -106,6 +106,7 @@ void gtk_action_disconnect_proxy (GtkAction *action, GSList* gtk_action_get_proxies (GtkAction *action); void gtk_action_connect_accelerator (GtkAction *action); void gtk_action_disconnect_accelerator (GtkAction *action); +G_CONST_RETURN gchar *gtk_action_get_accel_path (GtkAction *action); /* protected ... for use by child actions */ void gtk_action_block_activate_from (GtkAction *action, diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c index f081dc3dc5..7b22d7ae6e 100644 --- a/gtk/gtkactiongroup.c +++ b/gtk/gtkactiongroup.c @@ -387,7 +387,7 @@ gtk_action_group_real_get_action (GtkActionGroup *self, * * Since: 2.4 */ -const gchar * +G_CONST_RETURN gchar * gtk_action_group_get_name (GtkActionGroup *action_group) { g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL); diff --git a/gtk/gtkactiongroup.h b/gtk/gtkactiongroup.h index 138ed03c22..5469e8f224 100644 --- a/gtk/gtkactiongroup.h +++ b/gtk/gtkactiongroup.h @@ -105,7 +105,7 @@ struct _GtkRadioActionEntry GType gtk_action_group_get_type (void); GtkActionGroup *gtk_action_group_new (const gchar *name); -const gchar *gtk_action_group_get_name (GtkActionGroup *action_group); +G_CONST_RETURN gchar *gtk_action_group_get_name (GtkActionGroup *action_group); gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group); void gtk_action_group_set_sensitive (GtkActionGroup *action_group, gboolean sensitive); -- 2.30.2